# To change this template, choose Tools | Templates
# and open the template in the editor.

class Distance
  # Distanza euclidea
  def Distance.eclidean(x,y)
    eu= 0

    (0..x.size-1).each{|i|
      eu=eu + ((x[i]-y[i])**2)
    }

    return Math.sqrt(eu)
  end
  # Distanza euclidea quadra
  def Distance.squared_eclidean(x,y)
    eu= 0

    (0..x.size-1).each{|i|
      eu=eu + ((x[i]-y[i])**2)
    }

    return eu
  end
  # Distanza di Manhattan
    def Distance.manhattan(x,y)
    mn= 0

    (0..x.size-1).each{|i|
      mn=mn + (x[i]-y[i]).abs
    }

    return mn
  end
end
